package net.huashitong.Project.dao;

import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;
import net.huashitong.Project.entity.LeaderShip;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class LeaderShipDao extends StringDao<LeaderShip> {

    public boolean verifyLeaderExist(String leaderName) {
        GenericQuery query = createQuery("obj");
        query.append(" and obj.leaderName =:leaderName").setParam("leaderName", leaderName);
        int flag = query.count();
        if (flag > 0) {
            return true;
        }
        return false;
    }

    public LeaderShip queryByLeaderName(String leaderName){
        GenericQuery query = createQuery("obj");
        query.append(" and obj.leaderName =:leaderName").setParam("leaderName", leaderName);
        return query.firstResult();
    }
}
